package cn.wolfcode.wolf2w.business.controller;


import cn.wolfcode.wolf2w.business.api.domain.AnswerContent;
import cn.wolfcode.wolf2w.business.query.AnswerContentQuery;
import cn.wolfcode.wolf2w.business.service.IAnswerContentService;
import cn.wolfcode.wolf2w.common.core.domain.R;
import cn.wolfcode.wolf2w.common.security.annotation.InnerAuth;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 答案内容 Controller
 * 
 * @author zhuyaohua
 * @date 2024-10-01
 */
@RestController
@RequestMapping("answerContents")
public class AnswerContentController {
    @Autowired
    private IAnswerContentService answerContentService;
    /**
     * 答案内容详情
     */
    @GetMapping("/detail/{id}")
    public R<AnswerContent> detail(@PathVariable Long id) {
        AnswerContent answerContent = answerContentService.getById(id);
        return R.ok(answerContent);
    }
    /**
     * 答案内容 列表
     */
    @GetMapping("/query")
    public R<IPage<AnswerContent>> query(AnswerContentQuery qo) {
        IPage<AnswerContent> page = answerContentService.queryPage(qo);
        return R.ok(page);
    }


    /*****************************************对外暴露Fegin接口**********************************************/
    /**
     * Feign 接口
     */
    @GetMapping("/feign/list")
    public R<List<AnswerContent>> feignList() {
        return R.ok(answerContentService.list());
    }
    @InnerAuth
    @GetMapping("/feign/{id}")
    public R<AnswerContent> feignGet(@PathVariable Long id) {
        return R.ok(answerContentService.getById(id));
    }
}
